package psd.model.Prolog.Converters;

import org.eclipse.jdt.core.dom.LabeledStatement;

import psd.model.IConverter;
import psd.model.Prolog.FactGenerationToolbox;
import psd.model.Prolog.PrologConverter;


public class PrologLabeledStatementConverter extends PrologConverter implements
		IConverter<LabeledStatement> {

	public PrologLabeledStatementConverter(FactGenerationToolbox toolbox) {
		super(toolbox);
	}

	@Override
	public boolean convert(LabeledStatement node) {
		labels.put(node.getLabel().getIdentifier(), node);
		String body = idResolver.getID(node.getBody());
		String name = quote(node.getLabel().getIdentifier());
		String args[] = { body, name };
		createBodyFact(node, "labelT", args);
		writeSourceLocationArgumentIdentifier(node, node.getLabel());
		return true;
	}

}
